package com.cloud.test.usercustomerfeign.controller;

import com.cloud.test.usercustomerfeign.pojo.User;
import com.cloud.test.usercustomerfeign.userFeignClient.UserFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author HanLiBin
 * @version V1.0
 */
@RestController
public class UserController {
//    @Autowired
//    private RestTemplate template;

//    @GetMapping("/movice/{id}")
//    public User findOneById(@PathVariable Integer id) {
//        return template.getForObject("http://provide-user/simple/" + id, User.class);
//    }

    @Autowired
    private UserFeign userFeign;

    @GetMapping("/movice/{id}")
    public User getUser(@PathVariable Integer id){
       return userFeign.getUser(id);
    }
}
